import org.springframework.jdbc.object.MappingSqlQuery;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created with IntelliJ IDEA.
 * User: ttq
 * Date: 13-8-8
 * Time: 下午2:37
 * To change this template use File | Settings | File Templates.
 */
public class PersonMappingSqlQuery extends MappingSqlQuery {

    @Override
    protected Object mapRow(ResultSet resultSet, int i) throws SQLException {
        Person person = new Person();
        person.setId(resultSet.getInt("id"));
        person.setName(resultSet.getString("name"));
        person.setSex(resultSet.getString("sex"));
        person.setAge(resultSet.getInt("age"));
        person.setBirthday(resultSet.getTimestamp("birthday"));
        return person;
    }
}
